import request from '@/utils/request'

const modulePrefix = '/sys/roles/'

export function listPage(params) {
  return request({
    url: `${modulePrefix}page`,
    method: 'get',
    params
  })
}

export function save(data) {
  return request({
    url: modulePrefix,
    method: 'post',
    data
  })
}

export function update(data) {
  return request({
    url: modulePrefix,
    method: 'put',
    data
  })
}

export function remove(id) {
  return request({
    url: `${modulePrefix}${id}`,
    method: 'delete'
  })
}

export function find(id) {
  return request({
    url: `${modulePrefix}${id}`,
    method: 'get'
  })
}

export function listAll(params) {
  return request({
    url: `${modulePrefix}all`,
    method: 'get',
    params
  })
}

export function saveMenus(data) {
  return request({
    url: `${modulePrefix}menus`,
    method: 'post',
    data
  })
}

export function findAuthMenus(roleId) {
  return request({
    url: `${modulePrefix}menus/${roleId}`,
    method: 'get'
  })
}

